/**
 * 广寒宫
 * 网址:www.guanghangong.xyz
 */
package com.moon.admin.sys.domain;

import java.io.Serializable;
import java.util.Date;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.moon.admin.sys.cache.DeptCache;
import org.apache.commons.lang3.StringUtils;

import com.moon.admin.framework.util.ToolUtils;
import com.moon.admin.sys.entity.SysDeptEntity;
import com.moon.admin.sys.entity.SysPostEntity;

import lombok.Data;

/**
 * 岗位列表返回实体
 * @author moon
 */
@Data
public class PostListVO implements Serializable{

	private static final long serialVersionUID = 1384289303830780160L;

	private Integer id;
	
	private String postCode;
	
	private String postName;
	
	private String remark;
	
	private Integer deptId;
	
	private String deptName;

	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	private Date updateTime;
	
	public static PostListVO wrappers(SysPostEntity post) {
		PostListVO vo = ToolUtils.copy(post, PostListVO.class);
		SysDeptEntity entity = DeptCache.getDeptById(post.getDeptId());
		vo.setDeptName(entity==null?StringUtils.EMPTY:entity.getDeptName());
		return vo;
	}
}